package com.bss.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.andy.basics.AbstractNamedEntity;

@Entity
@Table(name = "PaymentType")
public class PaymentType extends AbstractNamedEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6317473483766027802L;
	private int id;
	private String name;
	private String description;
	private int balance;
	private Date lastUpdated;
	private boolean refundable;

	private Set<Payment> payments = new HashSet<Payment>(0);

	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return this.id;
	}

	@Override
	public void setId(final int id) {
		this.id = id;
	}

	@Column(name = "name", length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "paymentType")
	public Set<Payment> getPayments() {
		return this.payments;
	}

	public void setPayments(final Set<Payment> payments) {
		this.payments = payments;
	}

	public void setDescription(final String description) {
		this.description = description;
	}

	@Column(name = "description", length = 50)
	public String getDescription() {
		return this.description;
	}

	public void setBalance(final int balance) {
		this.balance = balance;
	}

	@Column(name = "balance")
	public int getBalance() {
		return this.balance;
	}

	public void setLastUpdated(final Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "lastUpdated", length = 19)
	public Date getLastUpdated() {
		return this.lastUpdated;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date", length = 19)
	public Date getDate() {
		return this.date;
	}

	public void setRefundable(final boolean refundable) {
		this.refundable = refundable;
	}

	public boolean isRefundable() {
		return this.refundable;
	}
}
